n = int(input())
print(6*n*n - 6*n + 1)
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../../inc/debug.h"
#else
#define debug(...)
#define debugv(...)
#endif
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int tt = 1;
// std::cin >> tt;
while(tt--) {
long long a;
std::cin >> a;
long long ans = 0;
int cnt = 0;
int crr = 0;
while(a--) {
if(cnt == 0) ans += 1;
else ans += 12 * cnt;
cnt++;
}
std::cout << ans << '\n';
}
return 0;
}
1366C - Palindromic Paths | 336A - Vasily the Bear and Triangle |
926A - 2-3-numbers | 276D - Little Girl and Maximum XOR |
1253C - Sweets Eating | 1047A - Little C Loves 3 I |
758D - Ability To Convert | 733A - Grasshopper And the String |
216A - Tiling with Hexagons | 1351B - Square |
1225A - Forgetting Things | 1717A - Madoka and Strange Thoughts |
1717B - Madoka and Underground Competitions | 61B - Hard Work |
959B - Mahmoud and Ehab and the message | 802G - Fake News (easy) |
1717C - Madoka and Formal Statement | 420A - Start Up |
1031A - Golden Plate | 1559C - Mocha and Hiking |
427B - Prison Transfer | 330A - Cakeminator |
426A - Sereja and Mugs | 363A - Soroban |
1585C - Minimize Distance | 1506E - Restoring the Permutation |
1539A - Contest Start | 363D - Renting Bikes |
1198D - Rectangle Painting 1 | 1023B - Pair of Toys |